def call(Map config) {
    def projectpom = readMavenPom file: 'pom.xml'
    def projectArtifactId = projectpom.getArtifactId()
    def TEST_NAMESPACE = "test"
    if(!stageCondition.masterCondition(BRANCH_NAME,params.buildRecordId)){
        return
    }
    container('maven') {
        if(config.jvmCacertsEnable){
            createJvmCacerts.deploySecret(TEST_NAMESPACE,projectArtifactId)
        }
        dir ("./k8sconfig/charts/${projectArtifactId}") {
            cred = creds.findCredsById('chartmuseum')
            CHARTMUSEUM_CREDS_USR = cred.password
            CHARTMUSEUM_CREDS_USR = cred.username
            sh "export FILE_NAME=${projectArtifactId} && export ALIYUN=${params.deploy_aliyun} && CHARTMUSEUM_CREDS_USR=${cred.username} && CHARTMUSEUM_CREDS_PSW=${cred.password} && make release"
            if(params.test_spaces){
                sh "helm template -n $TEST_NAMESPACE --output-dir . . "
                sh "kubectl apply -f ./$projectArtifactId/templates/ -n $TEST_NAMESPACE "
                //删除容器重新加载新部署的镜像
                sh "kubectl get pod -n $TEST_NAMESPACE  |grep $projectArtifactId | awk '{print \$1}'|xargs -I {} kubectl delete pod -n $TEST_NAMESPACE {} --force --grace-period=0"
            }
        }
    }
}